<script>
function redirectToApp()
{
	var Domain = document.getElementById("domain").value;
	var Service = document.getElementById("service").value;
	
	var Domain = Domain.replace("http://", '');
	var Domain = Domain.replace("https://", '');
	var Domain = Domain.replace("www.", '');
	var Domain = Domain.replace("/", '');
	
	localStorage.setItem('Domain', Domain);
	localStorage.setItem('Service', Service);
	
	if(Service == 'Mail')
	{
		var GoogleDomain = 'mail.google.com/a';
	}
	else if(Service == 'Calandar')
	{
		var GoogleDomain = 'google.com/calendar/hosted';
	}
	else if(Service == 'Docs')
	{
		var GoogleDomain = 'docs.google.com/a';
	}
	else if(Service == 'Settings')
	{
		var GoogleDomain = 'google.com/a';
	}
	
	window.open("http://" + GoogleDomain + "/" + Domain)
	
}

function setFormData()
{
	document.getElementById("domain").value = localStorage.getItem('Domain')
	document.getElementById("service").value = localStorage.getItem('Service')
}

</script>

<style>

body {
	margin:0px;
	background:#eaf3fd;
	border:#c6dff9 2px solid;
	padding:3px;
	font-family:Arial,Helvetica,sans-serif;
	font-size:12px;
	color:#666;
}

.header {
	background:url(images/header.jpg) repeat-x;
	height:25px;
	margin-bottom:3px;
	color:#FFF;
	padding-top:5px;
	padding-left:8px;
	font-weight:bold;
}

input, select {
	height:30px;
	border:2px #d7d7d7 solid;
	margin-bottom:5px;
	width:235px;
	padding-left:5px;
}

.button {
	background:url(images/button.gif);
	display:block;
	color:#555555;
	font-weight:bold;
	height:30px;
	line-height:29px;
	margin-bottom:14px;
	text-decoration:none;
	width:90px;
}
.login {
	background:url(images/user.gif) no-repeat 10px 8px;
	text-indent:30px;
	display:block;
	border:0px;
	width:80px;
	font-family:"Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif; 
	font-size:11px;
}
</style>

<body onLoad="setFormData()">

<div class="header">Google Apps Login</div>

<form id="appLogin" onSubmit="redirectToApp()">
    <label>Domain
	<input id="domain" type="text" value="" />
    </label>
    <label>Service
    	<select id="service">
        	<option>Mail</option>
            <option>Calandar</option>
            <option>Docs</option>
            <option>Settings</option>
        </select>
    </label>
    <div class="button"><input type="submit"  class="login" value="Login" /></div>
</form>
</body>